<!DOCTYPE HTML>
<html>
<head>
	<meta charset="utf-8">
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
	<meta http-equiv="Cache-Control" content="no-siteapp" />
	<!--[if lt IE 9]>
	<script type="text/javascript" src="lib/html5.js"></script>
	<script type="text/javascript" src="lib/respond.min.js"></script>
	<script type="text/javascript" src="lib/PIE_IE678.js"></script>
	<![endif]-->
	<link href="__PUBLIC__/css/H-ui.min.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/H-ui.admin.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" />
	<link href="__PUBLIC__/lib/Hui-iconfont/1.0.6/iconfont.css" rel="stylesheet" type="text/css" />
	<link href="Tpl/Service/common/center/index.css" rel="stylesheet" type="text/css" />
	<link href="Tpl/Service/common/order/page01.css" rel="stylesheet" type="text/css" />
	<!-- <link href="http://cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css" rel="stylesheet"> -->
	<!--[if IE 6]>
	<script type="text/javascript" src="http://lib.h-ui.net/DD_belatedPNG_0.0.8a-min.js" ></script>
	<script>DD_belatedPNG.fix('*');</script>
	<![endif]-->
	<title>客服中心</title>
	<style>
		.cursor_not{cursor: not-allowed;}
		.mb{margin-bottom: 1px}
		/*table{table-layout:fixed;word-break:break-all;}*/
		table tr td:nth-child(4),table tr th:nth-child(4){
		 width:200px!important;
		}
	</style>
</head>
<body>


		<assign name="phone_order" value="$Think.get.phone_order"/>
		<assign name='getTel' value="$Think.get.tel"/>
		<assign name="getCommunity" value="$Think.get.community_id"/>
		<assign name="getType" value="$Think.get.selectType"/>
	<div class="content">
		<div class="pd-20">
		</div>
		<div class="text-c" style="margin-bottom: 40px">
			<form action="" method="get"  autocomplete="off" class="sugForm" style="display: inline;">
			<input type="hidden" name="step" value="{$Think.get.step}"/>
			 日期范围：
		        <input onfocus="WdatePicker()" id="datemin" class="input-text Wdate" name="start_time" value="{$Think.get.start_time}" style="width:120px;" type="text">
		        -
		        <input onfocus="WdatePicker()" name="end_time" id="datemax" class="input-text Wdate" value="{$Think.get.end_time}" style="width:120px;margin-right: 56px" type="text">
				<input type="hidden" value="Assistant" name="m"/>
				<input type="hidden" value="WxOrder" name="c"/>
				<input type="hidden" value="orderList" name="a"/>
				<input type="hidden" value="{$Think.get.tel}" name="tel"/>
				<input type="hidden" value="{$Think.get.phone_order}" name="phone_order" id="phone_order"/>
				
				<span class="select-box" style="width: 140px;margin-right: 20px"> 
					<select name="selectType" class="select selectType" id="">
						<option value="">请选择搜索类型</option>
						<option value="1" {$getType==1?'selected':''}>事件说明</option>
						<option value="2" {$getType==2?'selected':''}>报修人</option>
						<option value="3" {$getType==3?'selected':''}>地址</option>
						<option value="4" {$getType==4?'selected':''}>维修工</option>
						<option value="5" {$getType==5?'selected':''}>客服</option>
						<option value="6" {$getType==6?'selected':''}>工单编号</option>
						</volist>
					</select>
				</span>
				<input type="text" class="input-text searchKey" style="width:300px" placeholder="输入关键词搜索" value="{$Think.get.key}" id="keyword" name="key">
				<button type="submit" class="btn btn-success radius searchButton" id="searchBtn" name=""><i class="Hui-iconfont">&#xe665;</i>搜索</button>
				
			</form>
			<button class="btn btn-primary radius" id="export_account">导出Excel</button>
		</div>
		<assign name="getStep" value="$Think.get.step"/>
		<div class="cl pd-5 bg-1 bk-gray mt-20 mb-20">
			<span class="l">
				<a href="{:U('orderList',array('step'=>10,'phone_order'=>$phone_order))}" class="btn radius familyDelBat {$getStep==10?' btn-primary':'btn-default'}">
					全部订单
				</a>
				<a href="{:U('orderList',array('step'=>1,'phone_order'=>$phone_order))}" class="btn radius familyDelBat {$getStep==1?' btn-primary':'btn-default'}">
					审核中
				</a>
				<a href="{:U('orderList',array('step'=>2,'phone_order'=>$phone_order))}" class="btn btn-default radius familyDelBat {$getStep==2?' btn-primary':'btn-default'}">
					抢单中
				</a>
				<a href="{:U('orderList',array('step'=>'3,4','phone_order'=>$phone_order))}" class="btn btn-default radius familyDelBat {$getStep=='3,4'?' btn-primary':'btn-default'}">
					修理中
				</a>
				<a href="{:U('orderList',array('step'=>'5,6','phone_order'=>$phone_order))}" class="btn btn-default radius familyDelBat {$getStep=='5,6'?' btn-primary':'btn-default'}">
					修理完成
				</a>
				<a href="{:U('orderList',array('step'=>7,'phone_order'=>$phone_order))}" class="btn btn-default radius familyDelBat {$getStep==7?' btn-primary':'btn-default'}">
					已评价
				</a>
				<a href="{:U('orderList',array('step'=>-2,'phone_order'=>$phone_order))}" class="btn radius familyDelBat {$getStep==-2?' btn-primary':'btn-default'}">
					已取消
				</a>
				<!-- <a style="display: none;" href="javascript:;" onclick="family_create('添加家庭','/index.php?m=Admin&amp;c=Family&amp;a=create','','500',this)" class="btn btn-primary radius addfamily" uid="">
					<i class="Hui-iconfont"></i>
					添加家庭
				</a> -->
			</span>
		</div>
<input type="hidden" name="nowId" id="nowId" value="{$data[0]['id']}"/>
<input type="hidden" name="getStep" id="getStep" value="{$getStep}"/>
		<table class="table table-border table-bordered table-bg" id="orderTable">
			<thead>
				<tr>
					<th scope="col" colspan="14">{$phone_order==1?'电话':'微信'}工单</th>
				</tr>
				<tr class="text-c" role="row">
					<th width="">订单编号</th>
					<th width="180">工单状态</th>
					<th width="180">工单大类</th>
					<th width="160">工单细类</th>
					<th width="800">事件说明</th>
					<th width="100">项目</th>
					<th width="140">报修人</th>
					<th width="120">地址</th>
					<th width="100">创建时间</th>
					<th width="180">抢单时间</th>
					<th width="160">维修工</th>
					<th width="180">操作客服</th>
					<th width="180">费用</th>
					<th width="80">操作</th>
				</tr>
			</thead>
               
			<tbody class="perTableTbody">
			<tr id="roll"></tr>
			<!-- <?php myDump($data[0]); ?> -->
				<volist name="data" id="v">
				   <tr class="text-c" class="odd" role="row">
					   <td>{$v.serialno}</td>
					   <!-- <td width="180">{$v.step_title}</td> -->
					   <td width="180">
						<if condition="$v['step_title']=='未受理' || $v['step_title']=='无人抢单'">
							<span style="color: #eb5b43">{$v.step_title}</span>
						<elseif condition="$v['step_title']=='价格确认完毕' || $v['step_title']=='开始维修'|| $v['step_title']=='价格确认中'|| $v['step_title']=='等待审核'" />
							<span style="color: #2075b6">{$v.step_title}</span>
						<elseif condition="$v['step_title']=='已取消'" />
							<span style="color: #843f08">{$v.step_title}</span>
						<elseif condition="$v['step_title']=='订单完成' || $v['step_title']=='完成维修'" />
							<span style="color: #159b61">{$v.step_title}</span>
						<elseif condition="$v['step_title']=='抢单中'" />
							<span style="color: #178483">{$v.step_title}</span>
						<elseif condition="$v['step_title']=='已评价'" />
							<span style="color: #992aef">{$v.step_title}</span>
						</if>
					   </td>
					   <td>{$v['type_name']}</td>
					   <td>{$v.entry_name}</td>
					   <td>{$v.info}</td>
					   <td>{$v.community_name}</td>
					   <td><span {$v['is_repair']==1?'style="color:red;"':''} title="{$v.customer.tel}">{$v.customer.realname}</span></td>
					   <!-- <td width="80">{$v.customer.tel}</td> -->
					   <td>{$v.address}</td>
					   <td>{$v.create_time}</td>
					   <td>{$v.rob_start_date}</td>
					   <td><span title="{$v.handler_mobile}">{$v.handler_name}</span></td>
					   <!-- <td width="220">{$v.handler_mobile}</td> -->
					   <td>{$v.service_name}</td>
					   <td>{$v.price}</td>
					   <td>
					   <a href="javascript:to4('{:U('info',array('id'=>$v['id']))}');"  class="label label-secondary radius cancel_order" >查看详情</a>
					   </td>
				   </tr>
			   </volist>
			</tbody>
		</table>
		<div style="text-align: center;" class="mt-20">{$page}</div>
		
	</div>
		<input type="hidden" name="" id="nowp" value="{$Think.get.p}"/>
		<input type="hidden" name="" id="phone_order" value="{$Think.get.phone_order}"/>
		<input type="hidden" name="" id="orderManage" value="{$orderManage}"/>

	</div>

	
	
<!--
	     
	    <iframe src="/index.php?m=Service&c=Order&a=orderList&customerId={$data[0].id}" frameborder="0" id="order"><input type="button" onclick="javascript:window.top.close();" value="关闭" /></iframe>
-->
	
	
	
	<script type="text/javascript" src="__PUBLIC__/lib/jquery/1.9.1/jquery.min.js"></script>
    <script src="http://cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/layer/2.1/layer.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/laypage/1.2/laypage.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/H-ui.admin.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/getUrl.js"></script>
	<script type="text/javascript" src="__PUBLIC__/lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
	<!--<script type="text/javascript" src="Tpl/Service/common/center/index.js"></script>-->
	<!-- <script type="text/javascript" src="Tpl/Service/common/order/lunxun.js"></script> -->
	<script type="text/javascript" src="/Public/lib/My97DatePicker/WdatePicker.js"></script>
	<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
	<script type="text/javascript">
	// 全局
		var info={
			id:0,//业主id
			tel:''
		};

	$(function(){
		info.id=$("#createOrder").attr("uid");
		info.tel=$.getUrlVar('tel');
		work.init();
	});
        
//功能实现
        var work={
	/*·····························初始化························*/
	init:function(){
		this.eventListen();
	},
	/*·····························事件监听························*/
	eventListen:function(){
		$(".telInfo").text(info.tel);
		
		 //搜索
		 $(document).on("click","#search",function(){
		 	var tel=$("#searchTel").val();
		 	var name=$("#searchName").val();
		 	var phone=$("#searchPhone").val();
		 	window.location.href='/index.php?m=Service&c=Center&a=choice&tel='+tel+'&name='+name+'&phone='+phone;
		 });

		// 查看工单
		$(document).on("click",".infoBtn",function(){
			var id=$(this).attr("uid");
			var title="工单详情";
			var url='/index.php?m=Service&c=Order&a=info&ID='+id;
			work.layerOpen(title,url);
		});
		// 创建用户
		$(document).on("click","#createCustomer",function(){
		if(info.tel.length==11){
				var whatFunc = {tel:info.tel};
				var whatWay = 'tel=';
			}else{
				var whatFunc = {phone:info.tel};
				var whatWay = 'phone=';
			};
			$.post("/index.php?m=Admin&c=Customer&a=add",whatFunc,function(data){
				if(data.stat==1){
					work.layerOpen('创建用户','/index.php?m=Service&c=Center&a=create&'+whatWay+info.tel+'&customerId='+data.pk);
				}else{
					layer.msg(data.msg);
				}
			});
			
		});
		//查看用户更多信息
		$(document).on("click","#customerInfoBtn",function(){
			var id=$(this).attr("uid");
			var url='/index.php?m=Service&c=Center&a=getCustomer&id='+id;
			work.layerCap("用户详情",url);
		});
	},
	/*·····························功能性函数························*/
	// iframe页面弹窗
	layerOpen:function(title,url){
		layer.open({
			type: 2,
			area: ['800px', '600px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.4,
			title: title,
			content:url,
			cancel:function(){
				location.replace(location.href);
			}
		});
	},
	//大弹窗
	layerOpenB:function(title,url){
		layer.open({
			type: 2,
			area: ['980px', '600px'],
			fix: false, //不固定
			maxmin: true,
			shade:0.4,
			title: title,
			content:url
		});
	},
		//创建用户
	layerCap:function(title,url){
		layer.open({
			type:2,
			shade: false,
		    title: title, //不显示标题
		    area: ['800px', '400px'],
		    content: url, //捕获的元素
		    cancel: function(index){
		        
		    }
		});
	}
}


 $(".borderR dl").hide();
        $(".borderR").mouseenter(
            function(){

                $(this).children("dl").show();
                }
        )

        $(".borderR").mouseleave(
            function(){

                $(this).children("dl").hide();
                }
        ); 

function to(url){
    layer.open({
        type: 2,
        title: '微信工单',
        fix:false,
        maxmin: true,
        area: ['1200px', '700px'],
        content: url
    });

}



function to4(url){
    layer.open({
        type: 2,
        title: '查看详情',
        fix:false,
        maxmin: true,
        area: ['800px', '500px'],
        content: url
    });

}

// $(function () {
//   $('[data-toggle="tooltip"]').tooltip()
// });

$(document).on("click","#export_account",function(){
            var start_time = $("#datemin").val();
            var end_time = $("#datemax").val();
            var step = $("#getStep").val();
            var key = $("#keyword").val();
            var phone_order = $("#phone_order").val();
            var community_id = $(".community_id option:selected").val();
			var selectType = $(".selectType option:selected").val();
            var url='/index.php?m=Service&c=WxOrder&a=dumpExcel&key='+key+'&step={$getStep}&start_time='+start_time+'&end_time='+end_time+'&community_id='+community_id+'&selectType='+selectType+'&phone_order='+phone_order;
            window.open(url);
        });

$(document).on("click","#order_deltete",function(){
    var uid = $(this).attr("uid");
                var trObj = $(this).closest("tr");
                var index = layer.confirm('确定删除该订单？', {
                    title: false
                }, function() {
                    layer.close(index);
                    $.post('/index.php?m=Service&c=WxOrder&a=delete&id='+uid, function(data) {
                        console.log(data);
                        if (data.status == 1) {
                            layer.msg('删除成功！', {
                                time: 1000
                            });
                            trObj.remove();
                        } else {
                            layer.msg('删除失败！', {
                            
                                time: 2000
                            });
                        }


                    });

                });
})
	</script>
	</body>
	</html>